package com.speed_run.global;

import com.speed_run.utils.CommonUtils;

import java.io.File;

public class GlobalMethod {
    public  static String getFilepath(String relativePath) {
        return GlobalMethod.class.getClassLoader().getResource("")
                .getPath().split("WEB-INF")[0]+ relativePath;
    }

    public static String getRelativePath(String s, String type) {
        if(type.equals("frame")){
            return "img"+ File.separator+"frame"+File.separator +
                    CommonUtils.getPicName()+"."+ s;
        }else if(type.equals("video")){
            return "video"+ File.separator +
                    CommonUtils.getPicName()+"."+ s;
        }else{
            return "img"+ File.separator+"album"+File.separator +
                    CommonUtils.getPicName()+"."+ s;
        }
    }
}
